<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "shbb_trace_type".
 *
 * @property integer $id
 * @property string $code
 * @property string $name
 * @property string $comment
 *
 * @property ShbbBatch[] $shbbBatches
 * @property ShbbTraceContent[] $shbbTraceContents
 */
class TraceSystemType extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shbb_trace_system_type';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['comment'], 'string'],
            [['code', 'name'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'code' => 'Code',
            'name' => 'Name',
            'comment' => 'Comment',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getShbbBatches()
    {
        return $this->hasMany(ShbbBatch::className(), ['trace_type_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getShbbTraceContents()
    {
        return $this->hasMany(ShbbTraceContent::className(), ['trace_type_id' => 'id']);
    }
}
